package cn.edu.scau.cmi.zenghanxiong.composite.safe;

import java.util.ArrayList;
import java.util.List;

public class SafeComposite extends SafeComponent{
	
    private List<SafeComponent> childList = new ArrayList<>();

    public SafeComposite(String name) {
        super(name);
    }

    public void addChild(SafeComponent child) {
        child.setParent(this);
        this.childList.add(child);
    }

    public void removeChild(SafeComponent child) {
        this.childList.remove(child);
    }

    public List<SafeComponent> getChildren() {
        return this.childList;
    }

    public String toString() {
        return "团队：" + super.toString();
    }

}
